package com.banzhi.shop;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.support.multidex.MultiDex;


import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;

import org.xutils.x;

import java.util.HashSet;

import cn.jpush.android.api.JPushInterface;


public class MyApp extends Application {
    public static final String APP_ID = "wxe2e5474e781d218a";
    public static final String AppSecret = "6dd8fe7ca3b1905c2e3896fb26ac111e";
    public static IWXAPI api;
    public static Context context;
    public static SharedPreferences loginMessage;
    public static final int ONE = 1;
    public static String Permisssion="android.permission.READ_EXTERNAL_STORAGE";
    /**
     * 用于判断是不已经在更新了
     */
    public static boolean IsCheck;
    public static int isBlackName = 0;//0就是啥都没干  ，1 不是黑名单   2 黑名单
    public static String BlackTiShi = "";  //黑名单的提示信息
    private static MyApp myApp;
    //客服SDK是否已经初始化过了
    public static boolean isKFSDK = false;
//    public static int jianum = 100;//每个商品的库存加100

    public static String accessID = "4a002340-825a-11e7-bdf8-3fda59d5a11b";

    @Override
    public void onCreate() {
        super.onCreate();
        //初始化sdk
        JPushInterface.setDebugMode(true);//正式版的时候设置false，关闭调试
        JPushInterface.init(this);
        //建议添加tag标签，发送消息的之后就可以指定tag标签来发送了
/*        Set<string> set = new HashSet<>();
        set.add("andfixdemo");//名字任意，可多添加几个
        JPushInterface.setTags(this, set, null);//设置标签*/
        context = this;
        myApp = this;
        loginMessage = getSharedPreferences("loginMessage", MODE_PRIVATE);
        x.Ext.init(this);
        x.Ext.setDebug(true);
        regToWx();
        //初始化表情,界面效果需要
        new Thread(new Runnable() {
            @Override
            public void run() {
                com.banzhi.shop.qimo.Utils.FaceConversionUtil.getInstace().getFileText(
                        MyApp.getInstance());
            }
        }).start();

    }

    private void regToWx() {
        api = WXAPIFactory.createWXAPI(this, APP_ID, true);
        api.registerApp(APP_ID);
    }

    public static MyApp getInstance() {
        return myApp;
    }
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}
